<?php
// .-----------------------------------------------------------------------------------
// | WE TRY THE BEST WAY 杭州博也网络科技有限公司
// |-----------------------------------------------------------------------------------
// | Author: 青 <99701759@qq.com>
// | Copyright (c) 2013-2016, http://www.itboye.com. All Rights Reserved.
// |-----------------------------------------------------------------------------------
// 微信用户表中的信息在$this->userinfo
// 用户newmember表的信息在$this->newmember中
// 用户角色表的信息在$this->role中
namespace app\web\controller;

use app\src\user\logic\UserMemberLogic;
use app\src\wallet\logic\WalletLogic;
use think\Controller;
use app\src\video\logic\UserVideoLogic;
use app\weixin\controller\Home;
use app\src\wxpay\logic\WxaccountLogic;
use app\src\product\logic\ProductLogic;
use app\src\file\logic\UserPictureLogic;
use app\src\fangwei\logic\fangweiLogic;
use app\src\user\logic\MemberLogic;
class Index extends Base{




    /*
     * 首页
     * */
    public function index(){

//        $memberinfo=$this->memberinfo;
//        $this->assign('user_Info',$memberinfo);
         $this->assignTitle('商品');
//        $result=(new WxaccountLogic())->getInfo(['id'=>1]);
//        $user_Info=session('user_Info');

        $pic=(new UserPictureLogic())->queryNoPaging(['type'=>'00E003']);
      //  dump($pic);
        $this->assign('pics', $pic['info']);
       // $role=$this->role;

        $map['onshelf']='1';
        $map['status']='1';
        $order='itboye_product.create_time desc';
        $result=(new ProductLogic())->plist($map,$order);
        if(!$result['status']) $this->error('查询数据出错');
        $product=$result['info'];

        $goods=[];$meal=[];
        foreach($product as $k=>$v){
            $list[$k]['id']=$v['id'];
          $list[$k]['name']=$v['name'];
          $list[$k]['img_id']=$v['img_main']['img_id'];
        }
      //  dump($list);exit;
        $this->assign('list', $list);


        return $this->fetch('index/index');
    }
    public function happy(){
        $name = 'haha';
        $this->assign('data',$name);
    }

    /*
     * 商品详情
     * */
    public function detail(){

        $map['id']=$this->_param('id');
        $order='itboye_product.create_time desc';
        $result=(new ProductLogic())->detail($map,$order);
        $detail=$result['info'][0];
      //  dump($detail);exit;
            $this->assign('detail',$detail);

        return $this->fetch('index/detail');
        }


    public function ajaxReturn($data){
        //不做处理
    }


    public function fangwei(){
        $this->assignTitle('幼柔产品中奖防伪查询');

            return $this->fetch();


    }
    public function contact(){


        return $this->fetch();


    }
    public function banner(){


        return $this->fetch();


    }
    public function about(){


        return $this->fetch();


    }
    public function news2(){
        $map['name'] = '资讯';
        $r = (new UserVideoLogic())->getInfo($map);
        $this -> assign('news', $r['info']);

        return $this->fetch();


    }
    public function cover(){


        return $this->fetch();


    }
    public function news(){
        $map['name'] = '新闻';
        $r = (new UserVideoLogic())->getInfo($map);

        $this -> assign('news', $r['info']);
        return $this->fetch();


    }

    public function findcode(){

         $code=$this->_param('code');


            $fw=(new fangweiLogic())->getInfo(['code'=>$code]);
        $order = array("\r\n", "\n", "\r");
        if($fw['info']!=null&&$fw['status']) {
            $this->success('更新成功','',str_replace($order, '', $fw['info']['value']));
        }else{
            $this->error('防伪码错误');
        }
    }

}